package com.zpark.entity.patients;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;

/**
 * 患者中药处方表
 * @TableName tcm_prescription
 */
@TableName(value ="tcm_prescription")
@Data
public class TcmPrescription implements Serializable {
    /**
     * 处方ID
     */
    @TableId(value = "prescription_id", type = IdType.AUTO)
    private Long prescriptionId;

    /**
     * 患者ID
     */
    @TableField(value = "patient_id")
    private Long patientId;

    /**
     * 患者姓名
     */
    @TableField(value = "patient_name")
    private String patientName;

    /**
     * 处方编号
     */
    @TableField(value = "prescription_no")
    private String prescriptionNo;

    /**
     * 方剂名称
     */
    @TableField(value = "prescription_name")
    private String prescriptionName;

    /**
     * 药材组成(JSON数组格式: [{name:药材名,dosage:用量}])
     */
    @TableField(value = "herbs")
    private Object herbs;

    /**
     * 用法(水煎服等)
     */
    @TableField(value = "usage_method")
    private String usageMethod;

    /**
     * 每日剂数
     */
    @TableField(value = "daily_dosage")
    private Integer dailyDosage;

    /**
     * 总天数
     */
    @TableField(value = "total_days")
    private Integer totalDays;

    /**
     * 煎服方法及注意事项
     */
    @TableField(value = "decoction_notes")
    private String decoctionNotes;

    /**
     * 开具日期
     */
    @TableField(value = "prescribed_date")
    private Date prescribedDate;

    /**
     * 状态(进行中/已完成/已取消)
     */
    @TableField(value = "status")
    private String status;

    /**
     * 创建时间
     */
    @TableField(value = "created_at")
    private Date createdAt;

    /**
     * 更新时间
     */
    @TableField(value = "updated_at")
    private Date updatedAt;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        TcmPrescription other = (TcmPrescription) that;
        return (this.getPrescriptionId() == null ? other.getPrescriptionId() == null : this.getPrescriptionId().equals(other.getPrescriptionId()))
            && (this.getPatientId() == null ? other.getPatientId() == null : this.getPatientId().equals(other.getPatientId()))
            && (this.getPatientName() == null ? other.getPatientName() == null : this.getPatientName().equals(other.getPatientName()))
            && (this.getPrescriptionNo() == null ? other.getPrescriptionNo() == null : this.getPrescriptionNo().equals(other.getPrescriptionNo()))
            && (this.getPrescriptionName() == null ? other.getPrescriptionName() == null : this.getPrescriptionName().equals(other.getPrescriptionName()))
            && (this.getHerbs() == null ? other.getHerbs() == null : this.getHerbs().equals(other.getHerbs()))
            && (this.getUsageMethod() == null ? other.getUsageMethod() == null : this.getUsageMethod().equals(other.getUsageMethod()))
            && (this.getDailyDosage() == null ? other.getDailyDosage() == null : this.getDailyDosage().equals(other.getDailyDosage()))
            && (this.getTotalDays() == null ? other.getTotalDays() == null : this.getTotalDays().equals(other.getTotalDays()))
            && (this.getDecoctionNotes() == null ? other.getDecoctionNotes() == null : this.getDecoctionNotes().equals(other.getDecoctionNotes()))
            && (this.getPrescribedDate() == null ? other.getPrescribedDate() == null : this.getPrescribedDate().equals(other.getPrescribedDate()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getCreatedAt() == null ? other.getCreatedAt() == null : this.getCreatedAt().equals(other.getCreatedAt()))
            && (this.getUpdatedAt() == null ? other.getUpdatedAt() == null : this.getUpdatedAt().equals(other.getUpdatedAt()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getPrescriptionId() == null) ? 0 : getPrescriptionId().hashCode());
        result = prime * result + ((getPatientId() == null) ? 0 : getPatientId().hashCode());
        result = prime * result + ((getPatientName() == null) ? 0 : getPatientName().hashCode());
        result = prime * result + ((getPrescriptionNo() == null) ? 0 : getPrescriptionNo().hashCode());
        result = prime * result + ((getPrescriptionName() == null) ? 0 : getPrescriptionName().hashCode());
        result = prime * result + ((getHerbs() == null) ? 0 : getHerbs().hashCode());
        result = prime * result + ((getUsageMethod() == null) ? 0 : getUsageMethod().hashCode());
        result = prime * result + ((getDailyDosage() == null) ? 0 : getDailyDosage().hashCode());
        result = prime * result + ((getTotalDays() == null) ? 0 : getTotalDays().hashCode());
        result = prime * result + ((getDecoctionNotes() == null) ? 0 : getDecoctionNotes().hashCode());
        result = prime * result + ((getPrescribedDate() == null) ? 0 : getPrescribedDate().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode());
        result = prime * result + ((getUpdatedAt() == null) ? 0 : getUpdatedAt().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", prescriptionId=").append(prescriptionId);
        sb.append(", patientId=").append(patientId);
        sb.append(", patientName=").append(patientName);
        sb.append(", prescriptionNo=").append(prescriptionNo);
        sb.append(", prescriptionName=").append(prescriptionName);
        sb.append(", herbs=").append(herbs);
        sb.append(", usageMethod=").append(usageMethod);
        sb.append(", dailyDosage=").append(dailyDosage);
        sb.append(", totalDays=").append(totalDays);
        sb.append(", decoctionNotes=").append(decoctionNotes);
        sb.append(", prescribedDate=").append(prescribedDate);
        sb.append(", status=").append(status);
        sb.append(", createdAt=").append(createdAt);
        sb.append(", updatedAt=").append(updatedAt);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}